
**************************************************************************************************************
/*
THIS DO-FILE:
	GET INFO ON SOCIAL NETWORKS AND LONG-TERM CARE FROM RAW HRS
	to use in Figures of LTCI
*/

*************************************************************************************************************

use "$rawdata\h98fin\h98sta\H98D_H.dta", clear
destring HHID, replace
destring FSUBHH, replace
gen long h4hhid=10*HHID+FSUBHH
rename F2243 nearrelatives4
rename F2244 nearfriends4
keep HHID h4hhid nearrelatives4 nearfriends4
save near4.dta, replace

use "$rawdata\h00core\h00sta\H00D_H.dta", clear
destring HHID, replace
destring GSUBHH, replace
gen long h5hhid=10*HHID+GSUBHH
rename G2494 nearrelatives5
rename G2495 nearfriends5
keep HHID h5hhid nearrelatives5 nearfriends5
save near5.dta, replace

use "$rawdata\h02core\h02sta\H02F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename HF174 nearrelatives6
rename HF175 nearfriends6
keep HHID hhidpn nearrelatives6 nearfriends6
save near6.dta, replace

use "$rawdata\h04core\h04sta\H04F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename JF174 nearrelatives7
rename JF175 nearfriends7
keep HHID hhidpn nearrelatives7 nearfriends7
save near7.dta, replace

use "$rawdata\h06core\h06sta\H06F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename KF174 nearrelatives8
rename KF175 nearfriends8
keep HHID hhidpn nearrelatives8 nearfriends8
save near8.dta, replace

use "$rawdata\h08core\h08sta\H08F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename LF174 nearrelatives9
rename LF175 nearfriends9
keep HHID hhidpn nearrelatives9 nearfriends9
save near9.dta, replace

use "$rawdata\h10core\h10sta\H10F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename MF174 nearrelatives10
rename MF175 nearfriends10
keep HHID hhidpn nearrelatives10 nearfriends10
save near10.dta, replace

use "$rawdata\h12core\h12sta\H12F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename NF174 nearrelatives11
rename NF175 nearfriends11
keep HHID hhidpn nearrelatives11 nearfriends11
save near11.dta, replace

use "$rawdata\h14core\h14sta\H14F_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename OF174 nearrelatives12
rename OF175 nearfriends12
keep HHID hhidpn nearrelatives12 nearfriends12
save near12.dta, replace

************************************************************
*helper availability (given not already receiving help)

use "$rawdata\h98fin\h98sta\H98E_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename F2684 helpavail4
keep HHID hhidpn
save helpavail4.dta, replace

use "$rawdata\h00core\h00sta\H00E_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename G3002 helpavail5
keep HHID hhidpn
save helpavail5.dta, replace

use "$rawdata\h02core\h02sta\H02G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename HG097 helpavail6
keep HHID hhidpn helpavail6
save helpavail6.dta, replace

use "$rawdata\h04core\h04sta\H04G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename JG097 helpavail7
keep HHID hhidpn helpavail7
save helpavail7.dta, replace

use "$rawdata\h06core\h06sta\H06G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename KG097 helpavail8
keep HHID hhidpn helpavail8
save helpavail8.dta, replace

use "$rawdata\h08core\h08sta\H08G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename LG097 helpavail9
keep HHID hhidpn helpavail9
save helpavail9.dta, replace

use "$rawdata\h10core\h10sta\H10G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename MG097 helpavail10
keep HHID hhidpn helpavail10
save helpavail10.dta, replace

use "$rawdata\h12core\h12sta\H12G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename NG097 helpavail11
keep HHID hhidpn helpavail11
save helpavail11.dta, replace

use "$rawdata\h14core\h14sta\H14G_R.dta", clear
destring HHID, replace
destring PN, replace
gen long hhidpn=1000*HHID+PN
rename OG097 helpavail12
keep HHID hhidpn helpavail12
save helpavail12.dta, replace

